import { rolldown } from 'rolldown';

const bundle = await rolldown({
  input: 'src/main.js',
});

await bundle.generate({
  format: 'esm',
});
await bundle.generate({
  format: 'cjs',
});

// or directly write to disk
await bundle.write({
  file: 'bundle.js',
});